#ifndef TABLEDISPLAY_H
#define TABLEDISPLAY_H

#include <QWidget>
#include <QImage>
#include <QPixmap>
#include <QSettings>
class TableDisplay : public QWidget
{
    Q_OBJECT
public:
    explicit TableDisplay(QWidget *parent = 0);
    /**
    * @brief 更新图像
    * @param image 新的图像
    * @param row 图像所在行
    * @param col 图像所在列
    * @return
    */
    void setImage(QImage &image, int row, int col);
    /**
    * @brief 清除所有的图像
    * @return
    */
    void cleanAll();
    ~TableDisplay();
protected:
    void paintEvent(QPaintEvent * event);
    void mouseDoubleClickEvent(QMouseEvent * event);
private:
    //QImage m_image[4][8];
    QPixmap m_pixmap[12][12];
    int m_colCount;
    int m_rowCount;
signals:
    void posDBClicked(int row, int col);
public slots:
    void loadSettings(QSettings &settings);
    void writeSettings(QSettings &settings);
};

#endif // TABLEDISPLAY_H
